package longrise.phone.com.bjjt_henan.compensate;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.longrise.android.FormParameter;
import com.longrise.android.FrameworkManager;
import com.longrise.android.LFView;

import longrise.phone.com.bjjt_henan.R;

/**
 * 事故上传成功界面，Created by Administrator on 2016/5/12.
 */

public class AccidentLoadingSuccessView extends LFView implements View.OnClickListener{
    private Context context = null;
    private View view = null;
    private Button bt_loadingsuccess_ensure;
    private String caseNo;
    private LinearLayout hn_btn_back;
    private TextView tv_title;

    public AccidentLoadingSuccessView(Context c,String caseNo) {
        super(c);
        this.context = c;
        this.caseNo=caseNo;
    }

    @Override
    public void refreshByTime() {

    }

    @Override
    public FormParameter getFormParameter() {
        FormParameter fp = new FormParameter();
        fp.setShowtitle(false);
        return fp;
    }

    @Override
    public void refresh() {

    }

    @Override
    public View getView() {
        return view;
    }

    @Override
    public void init() {
        initView();
        regEvent(true);


    }

    private void initView() {
        view = View.inflate(context, R.layout.view_accidentloadingsuccess, null);
        bt_loadingsuccess_ensure = (Button) view.findViewById(R.id.bt_loadingsuccess_ensure);
        hn_btn_back = (LinearLayout) view.findViewById(R.id.hn_btn_back);
        tv_title = (TextView) view.findViewById(R.id.tv_title);
        tv_title.setText("事故上传");
    }
    private void regEvent(boolean b) {
        if (null != bt_loadingsuccess_ensure) {
            bt_loadingsuccess_ensure.setOnClickListener(b ? this : null);
        }
        if (null != hn_btn_back) {
            hn_btn_back.setOnClickListener(b ? this : null);
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.bt_loadingsuccess_ensure:
                //进入等待定责页面
                AccidentCheckView checkView = new AccidentCheckView(context,caseNo,2);
                FrameworkManager.getInstance().showNewForm(context, checkView);
                break;
            case R.id.hn_btn_back:
                closeForm();
                OnDestroy();
                break;

        }
    }
}
